package indi.kider.server.woniubus.service;

import indi.kider.common.model.apabus.LogOpt;
import indi.kider.common.model.woniubus.LogOptQuery;
import indi.kider.server.apabus.mapper.LogOptMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.vankid.common.model.base.CommonResponse;
import pers.vankid.common.utils.page.PageRequest;
import pers.vankid.common.utils.page.PageUtil;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
@SuppressWarnings("ALL")
public class LogOptServiceImpl implements LogOptService {

    @Autowired
    private LogOptMapper logOptMapper;

    @Override
    public CommonResponse insertLogOpt(LogOpt logOpt) {
        logOpt.setOptTime(new Date());
        logOptMapper.insert(logOpt);
        return CommonResponse.buildAddSuccessResponse("保存日志成功!",null);
    }

    @Override
    public List<Map> queryLogOptList(PageRequest<LogOptQuery> request) {
        PageUtil.start(request);
        return logOptMapper.queryLogOptList(request.getQuery());
    }
}
